﻿package com.eaglesandcobras.games.scenes
{
	import com.eaglesandcobras.games.scenes.GamePage;
	import flash.display.MovieClip;
	import flash.events.*;
	
	public class HomePage extends GamePage
	{	
		private var _instructions:MovieClip;
		private var _instBtn:MovieClip;
		private var _instCloseBtn:MovieClip;
		
		public function HomePage()
		{
			super();
			track ("Start Game");
		}
		
		/****************************
		INSTRUCTIONS
		****************************/
		public function instructions($container:MovieClip, $activateBtn:MovieClip, $closeBtn:String):void {
			_instructions = $container;
			
			_instBtn = $activateBtn;
			_instBtn.buttonMode = true;
			_instBtn.addEventListener( MouseEvent.CLICK, showInstructions);
			
			_instCloseBtn = _instructions[$closeBtn];
			_instCloseBtn.buttonMode = true;
			_instCloseBtn.addEventListener( MouseEvent.CLICK, hideInstructions);
		}
		
		//---SHOW-->
		public function showInstructions(e:MouseEvent):void {
			content.visible = false;
			
			if (!this.contains(_instructions)) addChild (_instructions);
			_instructions.visible = true;
		}
		
		//---HIDE-->
		public function hideInstructions(e:MouseEvent):void {
			content.visible = true;
			
			if (this.contains(_instructions)) removeChild (_instructions);
			_instructions.visible = true;
		}
	}
}
